package com.example.mynewsapp.network

import com.example.mynewsapp.model.NewsModel
import com.example.mynewsapp.model.VideoModel
import com.example.mynewsapp.model.WeatherModel
import org.json.JSONArray
import org.json.JSONObject
import retrofit2.Call
import retrofit2.http.GET
import retrofit2.http.Query
import java.util.ArrayList

/**
 * Created by Azhar Rivaldi on 10-04-2021
 * Github : https://github.com/AzharRivaldi
 * Linkedin : https://www.linkedin.com/in/azhar-rivaldi
 * Instagram : https://www.instagram.com/azhardvls_
 * Twitter : https://twitter.com/azharrvldi_
 * Youtube Channel : https://bit.ly/2PJMowZ
 */

interface ApiInterface {
    @GET("top-headlines")
    fun getHeadlines(
            @Query("country") country: String?,
            @Query("apiKey") apiKey: String?
    ): Call<NewsModel>

    @GET("top-headlines")
    fun getSports(
            @Query("country") country: String?,
            @Query("category") category: String?,
            @Query("apiKey") apiKey: String?
    ): Call<NewsModel>

    @GET("top-headlines")
    fun getTechnology(
            @Query("country") country: String?,
            @Query("category") category: String?,
            @Query("apiKey") apiKey: String?
    ): Call<NewsModel>

    @GET("top-headlines")
    fun getBusiness(
            @Query("country") country: String?,
            @Query("category") category: String?,
            @Query("apiKey") apiKey: String?
    ): Call<NewsModel>

    @GET("top-headlines")
    fun getHealth(
            @Query("country") country: String?,
            @Query("category") category: String?,
            @Query("apiKey") apiKey: String?
    ): Call<NewsModel>

    @GET("top-headlines")
    fun getEntertainment(
            @Query("country") country: String?,
            @Query("category") category: String?,
            @Query("apiKey") apiKey: String?
    ): Call<NewsModel>

    @GET("everything")
    fun getNewsSearch(
            @Query("q") keyword: String?,
            @Query("language") language: String?,
            @Query("apiKey") apiKey: String?
    ): Call<NewsModel>

    @GET("videoCategoryDetails")
    fun getVideo(
            @Query("id") itemId: Int?
    ): Call<VideoModel>

    @GET("weather")
    fun getWeather(
        @Query("q") q: String,
        @Query("units") units: String,
        @Query("appid") appid: String,
        @Query("lang") lang: String
    ): Call<WeatherModel>
}